package com.itheima.web;

import com.github.pagehelper.PageInfo;
import com.itheima.Constants;
import com.itheima.pojo.User;
import com.itheima.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
public class UserController {

    @Autowired
    private IUserService userService;

    @ResponseBody
    @GetMapping("/findUsers")
    //@RequestMapping(value = "/findUsers",method = RequestMethod.GET)
    public PageInfo<User> findUsers(
            @RequestParam(value = "pageNo",defaultValue = Constants.PAGENO) int pageNo,
            @RequestParam(value = "pageSize",defaultValue = Constants.PAGESIZE) int pageSize){
        return userService.findUsers(pageNo,pageSize);
    }


}
